const studentDao = require("../dao/studentDao")
module.exports={
    //分页显示
    async showStundetInfosByPage({currentPage,pageSize}){
        //需要封装的分页对象
        let pageBean={};
        //封装当前页数
        pageBean.currentPage = currentPage;
        //封装每页显示的条数
        pageBean.pageSize = pageSize;
        //封装显示的数据
        let res =  await studentDao.getStudentsByPage({currentPage,pageSize});
        //封装显示的数据
        pageBean.datas = res;
        //封装总条数和总页数
        let nums =  await studentDao.getTolNums();
            //封装总条数
            pageBean.totalNum = nums;
            //计算出总页数
            //9 3   9/3= 3
            //10 3 10/3 =3.33333  /4页
            //let totalSize=Math.ceil(data/pageSize);
            pageBean.totalSize = Math.ceil(nums/pageSize);
        return pageBean;
    }
}
